#include<bits/stdc++.h>
using namespace std;
int num,loc,inl;//local airline/international airline
struct flight{
	int arr,dep;
	flight(){}
	flight(int a,int d){
		arr=a,dep=d;
	}
	static bool fight(flight a,flight b){
		return !((a.dep<b.arr)||(a.arr>b.dep));
	}
};
flight locf,inlf;
vector<vector<flight> > locg,inlg;
int main(){
	freopen("airport.in","r",stdin);
	freopen("airport.out","w",stdout);
	cin>>num>>loc>>inl;
	for(int i=0;i<loc;i++){
		
		cin>>locf.arr>>locf.dep;
		//cout<<locf[i].arr<<" "<<locf[i].dep<<endl;
		for(int j=0;j<=locg.size();j++){
			//cout<<locg.size()<<" "<<j<<" "<<locf[i].arr<<" "<<locf[i].dep<<endl;
			if(j==locg.size()){
				vector<flight> v;
				v.push_back(locf);
				locg.push_back(v);
				break;
			}
			else{
				bool ava=1;
				for(int k=0;k<locg[j].size();k++){
					//cout<<klocg[j].size()<<" "<<locf[i].arr<<" "<<locf[i].dep<<" "<<locg[j][k].arr<<" "<<locg[j][k].dep<<endl;
					if(flight::fight(locf,locg[j][k])){
						ava=0;
						break;
					}
				}
				if(ava){
					locg[j].push_back(locf);
					break;
				}
			}
		}
	}
	for(int i=0;i<inl;i++){
		cin>>inlf.arr>>inlf.dep;
		for(int j=0;j<=inlg.size();j++){
			if(j==inlg.size()){
				vector<flight> v;
				v.push_back(inlf);
				inlg.push_back(v);
				break;
			}
			else{
				bool ava=1;
				for(int k=0;k<inlg[j].size();k++){
					if(flight::fight(inlf,inlg[j][k])){
						ava=0;
						break;
					}
				}
				if(ava){
					inlg[j].push_back(inlf);
					break;
				}
			}
		}
	}
	int maxn=0;
	for(int i=0;i<=num;i++){
		int locl=i,inll=num-i;
		if(locl>locg.size()||inll>inlg.size())continue;
		int del=0;
		for(int j=0;j<locl;j++){
			del+=locg[j].size();
		}
		for(int j=0;j<inll;j++){
			del+=inlg[j].size();
		}
		maxn=max(maxn,del);
	}
	cout<<maxn<<endl;
	return 0;
}
